Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(world,store): add initialize method, initialize core tables in core module #1472

Merged
merged 12 commits into from
Sep 13, 2023

Conversation

alvrs
Copy link
Member

@alvrs alvrs commented Sep 13, 2023

purpose is to save a lot of bytecode in the World and WorldFacory contracts

Before (contract,size,margin) After (contract,size,margin)
CleanShot 2023-09-13 at 21 53 52@2x CleanShot 2023-09-13 at 21 54 44@2x

@alvrs alvrs requested a review from holic as a code owner September 13, 2023 20:56
@changeset-bot
Copy link

changeset-bot bot commented Sep 13, 2023

🦋 Changeset detected

Latest commit: 59796f2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 28 packages
Name Type
@latticexyz/store Major
@latticexyz/cli Major
@latticexyz/world Major
@latticexyz/dev-tools Major
@latticexyz/react Major
@latticexyz/store-indexer Major
@latticexyz/store-sync Major
@latticexyz/abi-ts Major
@latticexyz/block-logs-stream Major
@latticexyz/common Major
@latticexyz/config Major
create-mud Major
@latticexyz/ecs-browser Major
@latticexyz/gas-report Major
@latticexyz/network Major
@latticexyz/noise Major
@latticexyz/phaserx Major
@latticexyz/protocol-parser Major
@latticexyz/recs Major
@latticexyz/schema-type Major
@latticexyz/services Major
@latticexyz/solecs Major
solhint-config-mud Major
solhint-plugin-mud Major
@latticexyz/std-client Major
@latticexyz/std-contracts Major
@latticexyz/store-cache Major
@latticexyz/utils Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -50,6 +51,7 @@ contract CoreModule is Module {
}

function installRoot(bytes memory) public override {
StoreCore.registerCoreTables();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if this should be in _registerCoreTables

---
"@latticexyz/cli": patch
"@latticexyz/store": patch
"@latticexyz/world": patch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add another changeset for #1385?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh true forgot it there. Could do that in a separate followup though, this PR doesn't actually use the WorldFactory yet (because calling initialize in a separate transaction is supported it's not strictly necessary.)

holic
holic previously approved these changes Sep 13, 2023
Copy link
Member

@holic holic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wooo 4kb is a good chunk of savings

Comment on lines 15 to 17

- The `StoreRead` contract no longer calls `StoreCore.initialize` in its constructor.
`StoreCore` consumers are expected to call `StoreCore.initialize` and `StoreCore.registerCoreTable` in their own setup logic.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- The `StoreRead` contract no longer calls `StoreCore.initialize` in its constructor.
`StoreCore` consumers are expected to call `StoreCore.initialize` and `StoreCore.registerCoreTable` in their own setup logic.

moving this to its own changeset bc it's the only major change

@alvrs alvrs merged commit c049c23 into main Sep 13, 2023
@alvrs alvrs deleted the alvrs/initializer branch September 13, 2023 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants